package com.logicfishsoftware.plugbench.serializer;

import com.google.inject.Inject;
import com.google.inject.Provider;
import com.logicfishsoftware.plugbench.services.WPPlugBenchGrammarAccess;
import com.logicfishsoftware.plugbench.wPPlugBench.AdminPage;
import com.logicfishsoftware.plugbench.wPPlugBench.BooleanOption;
import com.logicfishsoftware.plugbench.wPPlugBench.ChoiceFn;
import com.logicfishsoftware.plugbench.wPPlugBench.ChoiceOption;
import com.logicfishsoftware.plugbench.wPPlugBench.ChoiceParam;
import com.logicfishsoftware.plugbench.wPPlugBench.ColourOption;
import com.logicfishsoftware.plugbench.wPPlugBench.CustomOption;
import com.logicfishsoftware.plugbench.wPPlugBench.CustomParam;
import com.logicfishsoftware.plugbench.wPPlugBench.CustomParamFn;
import com.logicfishsoftware.plugbench.wPPlugBench.DateOption;
import com.logicfishsoftware.plugbench.wPPlugBench.DefaultOptionParam;
import com.logicfishsoftware.plugbench.wPPlugBench.FloatOption;
import com.logicfishsoftware.plugbench.wPPlugBench.FunctionType;
import com.logicfishsoftware.plugbench.wPPlugBench.IntegerOption;
import com.logicfishsoftware.plugbench.wPPlugBench.Option;
import com.logicfishsoftware.plugbench.wPPlugBench.Options;
import com.logicfishsoftware.plugbench.wPPlugBench.OptionsPage;
import com.logicfishsoftware.plugbench.wPPlugBench.Plugin;
import com.logicfishsoftware.plugbench.wPPlugBench.RangeOption;
import com.logicfishsoftware.plugbench.wPPlugBench.SelectOption;
import com.logicfishsoftware.plugbench.wPPlugBench.SelectParam;
import com.logicfishsoftware.plugbench.wPPlugBench.StringOption;
import com.logicfishsoftware.plugbench.wPPlugBench.StringParam;
import com.logicfishsoftware.plugbench.wPPlugBench.TextOption;
import com.logicfishsoftware.plugbench.wPPlugBench.TextParam;
import com.logicfishsoftware.plugbench.wPPlugBench.URLOption;
import com.logicfishsoftware.plugbench.wPPlugBench.WPPlugBenchPackage;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.xtext.serializer.acceptor.ISemanticSequenceAcceptor;
import org.eclipse.xtext.serializer.acceptor.SequenceFeeder;
import org.eclipse.xtext.serializer.diagnostic.ISemanticSequencerDiagnosticProvider;
import org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic.Acceptor;
import org.eclipse.xtext.serializer.sequencer.AbstractDelegatingSemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.GenericSequencer;
import org.eclipse.xtext.serializer.sequencer.ISemanticNodeProvider.INodesForEObjectProvider;
import org.eclipse.xtext.serializer.sequencer.ISemanticSequencer;
import org.eclipse.xtext.serializer.sequencer.ITransientValueService;
import org.eclipse.xtext.serializer.sequencer.ITransientValueService.ValueTransient;

@SuppressWarnings("all")
public class WPPlugBenchSemanticSequencer extends AbstractDelegatingSemanticSequencer {

	@Inject
	private WPPlugBenchGrammarAccess grammarAccess;
	
	public void createSequence(EObject context, EObject semanticObject) {
		if(semanticObject.eClass().getEPackage() == WPPlugBenchPackage.eINSTANCE) switch(semanticObject.eClass().getClassifierID()) {
			case WPPlugBenchPackage.ADMIN_PAGE:
				if(context == grammarAccess.getAdminPageRule()) {
					sequence_AdminPage(context, (AdminPage) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.BOOLEAN_OPTION:
				if(context == grammarAccess.getBooleanOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_BooleanOption(context, (BooleanOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CHOICE_FN:
				if(context == grammarAccess.getChoiceFnRule()) {
					sequence_ChoiceFn(context, (ChoiceFn) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CHOICE_OPTION:
				if(context == grammarAccess.getChoiceOptionRule() ||
				   context == grammarAccess.getMultiChoiceOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_ChoiceOption(context, (ChoiceOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CHOICE_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getChoiceParamRule()) {
					sequence_ChoiceParam(context, (ChoiceParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.COLOUR_OPTION:
				if(context == grammarAccess.getColourOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_ColourOption(context, (ColourOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CUSTOM_OPTION:
				if(context == grammarAccess.getCustomOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_CustomOption(context, (CustomOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CUSTOM_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getCustomParamRule()) {
					sequence_CustomParam(context, (CustomParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.CUSTOM_PARAM_FN:
				if(context == grammarAccess.getCustomParamFnRule()) {
					sequence_CustomParamFn(context, (CustomParamFn) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.DATE_OPTION:
				if(context == grammarAccess.getDateOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_DateOption(context, (DateOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.DEFAULT_OPTION_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getAbstractStringParamRule() ||
				   context == grammarAccess.getChoiceParamRule() ||
				   context == grammarAccess.getCustomParamRule() ||
				   context == grammarAccess.getDefaultOptionParamRule() ||
				   context == grammarAccess.getSelectParamRule() ||
				   context == grammarAccess.getStringParamRule() ||
				   context == grammarAccess.getTextParamRule()) {
					sequence_DefaultOptionParam(context, (DefaultOptionParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.FLOAT_OPTION:
				if(context == grammarAccess.getFloatOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_FloatOption(context, (FloatOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.FUNCTION_TYPE:
				if(context == grammarAccess.getFunctionTypeRule()) {
					sequence_FunctionType(context, (FunctionType) semanticObject); 
					return; 
				}
				else if(context == grammarAccess.getFunctionRule()) {
					sequence_Function_FunctionType(context, (FunctionType) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.INTEGER_OPTION:
				if(context == grammarAccess.getIntegerOptionRule() ||
				   context == grammarAccess.getOptionTypeRule()) {
					sequence_IntegerOption(context, (IntegerOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.OPTION:
				if(context == grammarAccess.getOptionRule()) {
					sequence_Option(context, (Option) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.OPTIONS:
				if(context == grammarAccess.getOptionsRule()) {
					sequence_Options(context, (Options) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.OPTIONS_PAGE:
				if(context == grammarAccess.getOptionsPageRule()) {
					sequence_OptionsPage(context, (OptionsPage) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.PLUGIN:
				if(context == grammarAccess.getPluginRule()) {
					sequence_Plugin(context, (Plugin) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.RANGE_OPTION:
				if(context == grammarAccess.getOptionTypeRule() ||
				   context == grammarAccess.getRangeOptionRule()) {
					sequence_RangeOption(context, (RangeOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.SELECT_OPTION:
				if(context == grammarAccess.getMultiChoiceOptionRule() ||
				   context == grammarAccess.getOptionTypeRule() ||
				   context == grammarAccess.getSelectOptionRule()) {
					sequence_SelectOption(context, (SelectOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.SELECT_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getSelectParamRule()) {
					sequence_SelectParam(context, (SelectParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.STRING_OPTION:
				if(context == grammarAccess.getOptionTypeRule() ||
				   context == grammarAccess.getStringOptionRule()) {
					sequence_StringOption(context, (StringOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.STRING_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getAbstractStringParamRule() ||
				   context == grammarAccess.getStringParamRule() ||
				   context == grammarAccess.getTextParamRule()) {
					sequence_StringParam(context, (StringParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.TEXT_OPTION:
				if(context == grammarAccess.getOptionTypeRule() ||
				   context == grammarAccess.getTextOptionRule()) {
					sequence_TextOption(context, (TextOption) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.TEXT_PARAM:
				if(context == grammarAccess.getAbstractParamRule() ||
				   context == grammarAccess.getAbstractStringParamRule() ||
				   context == grammarAccess.getTextParamRule()) {
					sequence_TextParam(context, (TextParam) semanticObject); 
					return; 
				}
				else break;
			case WPPlugBenchPackage.URL_OPTION:
				if(context == grammarAccess.getOptionTypeRule() ||
				   context == grammarAccess.getURLOptionRule()) {
					sequence_URLOption(context, (URLOption) semanticObject); 
					return; 
				}
				else break;
			}
		if (errorAcceptor != null) errorAcceptor.accept(diagnosticProvider.createInvalidContextOrTypeDiagnostic(semanticObject, context));
	}
	
	/**
	 * Constraint:
	 *     (name=ID title=STRING description=STRING?)
	 */
	protected void sequence_AdminPage(EObject context, AdminPage semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_BooleanOption(EObject context, BooleanOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (name=ID title=STRING?)
	 */
	protected void sequence_ChoiceFn(EObject context, ChoiceFn semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=ChoiceParam param+=ChoiceParam*)?)
	 */
	protected void sequence_ChoiceOption(EObject context, ChoiceOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     choice=ChoiceFn
	 */
	protected void sequence_ChoiceParam(EObject context, ChoiceParam semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.CHOICE_PARAM__CHOICE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.CHOICE_PARAM__CHOICE));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getChoiceParamAccess().getChoiceChoiceFnParserRuleCall_1_0(), semanticObject.getChoice());
		feeder.finish();
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_ColourOption(EObject context, ColourOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=CustomParam param+=CustomParam*)?)
	 */
	protected void sequence_CustomOption(EObject context, CustomOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (id=ID value=STRING)
	 */
	protected void sequence_CustomParamFn(EObject context, CustomParamFn semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.CUSTOM_PARAM_FN__ID) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.CUSTOM_PARAM_FN__ID));
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.CUSTOM_PARAM_FN__VALUE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.CUSTOM_PARAM_FN__VALUE));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getCustomParamFnAccess().getIdIDTerminalRuleCall_0_0(), semanticObject.getId());
		feeder.accept(grammarAccess.getCustomParamFnAccess().getValueSTRINGTerminalRuleCall_2_0(), semanticObject.getValue());
		feeder.finish();
	}
	
	
	/**
	 * Constraint:
	 *     (className=STRING | customSettings+=CustomParamFn)
	 */
	protected void sequence_CustomParam(EObject context, CustomParam semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_DateOption(EObject context, DateOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     site?='site'
	 */
	protected void sequence_DefaultOptionParam(EObject context, DefaultOptionParam semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_FloatOption(EObject context, FloatOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (type='action' | type='filter' | type='activation' | type='deactivation' | (type='uninstall' tag=STRING (priority=INT acceptedArgs=INT?)?))
	 */
	protected void sequence_FunctionType(EObject context, FunctionType semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (
	 *         (type='action' | type='filter' | type='activation' | type='deactivation' | (type='uninstall' tag=STRING (priority=INT acceptedArgs=INT?)?)) 
	 *         name=ID 
	 *         call=ID? 
	 *         body=STRING?
	 *     )
	 */
	protected void sequence_Function_FunctionType(EObject context, FunctionType semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_IntegerOption(EObject context, IntegerOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (name=ID type=OptionType)
	 */
	protected void sequence_Option(EObject context, Option semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.OPTION__NAME) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.OPTION__NAME));
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.OPTION__TYPE) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.OPTION__TYPE));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getOptionAccess().getNameIDTerminalRuleCall_0_0(), semanticObject.getName());
		feeder.accept(grammarAccess.getOptionAccess().getTypeOptionTypeParserRuleCall_1_0(), semanticObject.getType());
		feeder.finish();
	}
	
	
	/**
	 * Constraint:
	 *     (name=ID site?='site'? title=STRING header=STRING? (options+=[Option|ID]+ footer=STRING?)?)
	 */
	protected void sequence_OptionsPage(EObject context, OptionsPage semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (options+=Option*)
	 */
	protected void sequence_Options(EObject context, Options semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (
	 *         imports+=STRING* 
	 *         (type='plugin' | type='library') 
	 *         name=ID 
	 *         platform=Platform? 
	 *         title=STRING 
	 *         version=STRING? 
	 *         pluginURI=STRING? 
	 *         description=STRING? 
	 *         author=STRING? 
	 *         skin=STRING? 
	 *         include+=STRING* 
	 *         script+=STRING* 
	 *         css+=STRING* 
	 *         script+=STRING* 
	 *         adminCSS+=STRING* 
	 *         options=Options? 
	 *         optionsPage+=OptionsPage* 
	 *         adminPages+=AdminPage* 
	 *         functions+=Function*
	 *     )
	 */
	protected void sequence_Plugin(EObject context, Plugin semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_RangeOption(EObject context, RangeOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=SelectParam param+=SelectParam*)?)
	 */
	protected void sequence_SelectOption(EObject context, SelectOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     select=ChoiceFn
	 */
	protected void sequence_SelectParam(EObject context, SelectParam semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.SELECT_PARAM__SELECT) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.SELECT_PARAM__SELECT));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getSelectParamAccess().getSelectChoiceFnParserRuleCall_1_0(), semanticObject.getSelect());
		feeder.finish();
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=StringParam param+=StringParam*)?)
	 */
	protected void sequence_StringOption(EObject context, StringOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     (max=INT | min=INT)
	 */
	protected void sequence_StringParam(EObject context, StringParam semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=TextParam param+=TextParam*)?)
	 */
	protected void sequence_TextOption(EObject context, TextOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
	
	
	/**
	 * Constraint:
	 *     html?='html'
	 */
	protected void sequence_TextParam(EObject context, TextParam semanticObject) {
		if(errorAcceptor != null) {
			if(transientValues.isValueTransient(semanticObject, WPPlugBenchPackage.Literals.TEXT_PARAM__HTML) == ValueTransient.YES)
				errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, WPPlugBenchPackage.Literals.TEXT_PARAM__HTML));
		}
		INodesForEObjectProvider nodes = createNodeProvider(semanticObject);
		SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes);
		feeder.accept(grammarAccess.getTextParamAccess().getHtmlHtmlKeyword_1_0(), semanticObject.isHtml());
		feeder.finish();
	}
	
	
	/**
	 * Constraint:
	 *     ((param+=DefaultOptionParam param+=DefaultOptionParam*)?)
	 */
	protected void sequence_URLOption(EObject context, URLOption semanticObject) {
		genericSequencer.createSequence(context, semanticObject);
	}
}
